package java_thinking.unit_10._10_4;

class Parcel4 {
    /**
     * 只有Parcel4内部才能访问
     */
    private class PContents implements Contents{
        private int i =11;
        @Override
        public int value(){
            return i;
        }
    }

    /**
     * Parcel4及其子类、还有与Parcel4同一个包中的类能访问
     */
    protected class PDestination implements Destination{
        private String label;
        private PDestination(String whereTo){
            this.label = whereTo;
        }
        @Override
        public String readLabel(){
            return label;
        }
    }
    public Destination destination(String s){
        return new PDestination(s);
    }
    public PContents contents(){
        return new PContents();
    }
}
class TestParcel {
    public static void main(String[] args) {
        Parcel4 parcel4 = new Parcel4();
        Contents contents = parcel4.contents();
        Destination destination = parcel4.destination("ss");

    }
}
